package com.spgf.controller.fragments;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.spgf.controller.CategoriaCadActivity;
import com.spgf.controller.CategoriaMntActivity;
import com.spgf.controller.DespesaCadActivity;
import com.spgf.controller.DespesaMntSwipeActivity;
import com.spgf.controller.OrcamentoCadActivity;
import com.spgf.controller.OrcamentoMntActivity;
import com.spgf.controller.R;

public class ManutencaoFragment extends Fragment implements Button.OnClickListener {

	private View	rootView;

	@Override
	public void onClick(View pView) {

		if (pView.getId() == R.id.btn_manutencao_nova_categoria) {
			Intent lIntent = new Intent(rootView.getContext(), CategoriaCadActivity.class);
			startActivity(lIntent);
		}

		else if (pView.getId() == R.id.btn_manutencao_visualizar_categorias) {
			Intent lIntent = new Intent(rootView.getContext(), CategoriaMntActivity.class);
			startActivity(lIntent);
		}

		else if (pView.getId() == R.id.btn_manutencao_nova_despesa) {
			Intent lIntent = new Intent(rootView.getContext(), DespesaCadActivity.class);
			startActivity(lIntent);
		}

		else if (pView.getId() == R.id.btn_manutencao_visualizar_despesas) {
			Intent lIntent = new Intent(rootView.getContext(), DespesaMntSwipeActivity.class);
			startActivity(lIntent);
		}

		else if (pView.getId() == R.id.btn_manutencao_novo_orcamento) {
			Intent lIntent = new Intent(rootView.getContext(), OrcamentoCadActivity.class);
			startActivity(lIntent);
		}

		else if (pView.getId() == R.id.btn_manutencao_visualizar_orcamento) {
			Intent lIntent = new Intent(rootView.getContext(), OrcamentoMntActivity.class);
			startActivity(lIntent);
		}
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

		rootView = inflater.inflate(R.layout.activity_manutencao, container, false);

		((Button) rootView.findViewById(R.id.btn_manutencao_nova_categoria)).setOnClickListener(this);
		((Button) rootView.findViewById(R.id.btn_manutencao_visualizar_categorias)).setOnClickListener(this);

		((Button) rootView.findViewById(R.id.btn_manutencao_nova_despesa)).setOnClickListener(this);
		((Button) rootView.findViewById(R.id.btn_manutencao_visualizar_despesas)).setOnClickListener(this);

		((Button) rootView.findViewById(R.id.btn_manutencao_novo_orcamento)).setOnClickListener(this);
		((Button) rootView.findViewById(R.id.btn_manutencao_visualizar_orcamento)).setOnClickListener(this);

		return rootView;
	}
}